home *** CD-ROM | disk | FTP | other *** search
- (*===========================================================================*)
- (* Find/Search -- Forward subroutine *)
- (* *)
- (* Copyright 1988, 1989, 1990, 1991 by H. Roy Engehausen. All rights *)
- (* reserved. *)
- (* *)
- (* This software may be freely distributed and used, but it may not *)
- (* under any circumstances be sold by anyone other than the author. *)
- (* It may be distributed by a commercial company as long as it is *)
- (* for no cost. *)
- (* *)
- (*===========================================================================*)
-
- PROCEDURE do_fwd_search;
-
- VAR
- i : BYTE;
- j : BYTE;
- msg_dis : msg_d_ptr;
-
- CONST
- no_bbs = '@BLANK';
-
- BEGIN;
-
- WITH our_search, msg_index_current^.msg_i_mb DO
- BEGIN;
-
- (*-------------------------------------------------------------------*)
- (* Check the message number *)
- (*-------------------------------------------------------------------*)
-
- IF msg_number < msg_route_num THEN
- EXIT;
-
- (*-------------------------------------------------------------------*)
- (* Check the distribution list (if any) *)
- (*-------------------------------------------------------------------*)
-
- IF (msg_flag AND mf_fwd_list) <> 0 THEN
- BEGIN;
-
- msg_dis := find_dist_list (msg_index_current);
-
- (*-------------------------------------------------------------*)
- (* Here we are about to check the distribution list *)
- (*-------------------------------------------------------------*)
-
- i := 0;
- j := msg_dis^.msg_d_no;
- REPEAT;
- INC(i);
- WITH msg_dis^.msg_d_array[i] DO
- BEGIN;
- IF ((df_fwd AND msg_d_flag) = 0)
- AND ((df_fwd_select AND msg_d_flag) = 0) THEN
- found := match_str(msg_d_info, search_str);
- END;
- UNTIL found OR (i >= j);
-
- (*-------------------------------------------------------------*)
- (* Search_fi gets set to the index into the distribution list *)
- (*-------------------------------------------------------------*)
-
- search_fi := i;
-
- (*-------------------------------------------------------------*)
- (* All done! *)
- (*-------------------------------------------------------------*)
-
- EXIT;
-
- END; (*----- End distribution list address ----------------------*)
-
- (*-------------------------------------------------------------------*)
- (* No distribution list. Check the TO field if no TOBBS *)
- (* search_fi = 0 signifying hit in this area. Note: If no *)
- (* TOBBS then we search no further than this check. *)
- (*-------------------------------------------------------------------*)
-
- search_fi := 0;
-
- IF LENGTH(msg_to_at) = 0 THEN
- BEGIN;
- IF (LENGTH(search_str) = LENGTH(no_bbs))
- AND (search_str = no_bbs) THEN
- found := TRUE
- ELSE
- found := match_str(msg_to, search_str);
- EXIT;
- END;
-
- (*-------------------------------------------------------------------*)
- (* Check the TO BBS field. If we find it then leave. Also leave *)
- (* if the hierarchical address is empty *)
- (*-------------------------------------------------------------------*)
-
- found := match_str(msg_to_at, search_str);
-
- IF found OR (msg_to_h = '') THEN
- EXIT;
-
- (*-------------------------------------------------------------------*)
- (* Now the lookup *)
- (*-------------------------------------------------------------------*)
-
- i := 1;
- REPEAT
- found := match_str(COPY(msg_to_h, i, 255), search_str);
- IF found THEN EXIT;
- INC(i);
- WHILE (i < LENGTH(msg_to_h)) AND (msg_to_h[i] <> '.') DO
- INC(i);
- INC(i);
- UNTIL i >= LENGTH(msg_to_h);
-
- END;
-
- END;